package proxyTest;

import com.proxy.proxyClass.Poet;
import com.proxy.proxyClass.impl.GrandPoet;
import com.proxy.proxyType.GrandPoetDynamicProxy;
import com.proxy.proxyType.StaticPoetProxy;
import org.junit.jupiter.api.Test;

/**
 * @Title: Test1
 * @Author xiaowu
 * @Package proxyTest
 * @Data 2024/5/21 10:44
 * @Description:
 */
public class Test1 {
    @Test
    public void test(){
        System.out.println("静态代理");
        Poet poet = new StaticPoetProxy();
        poet.readPoet();
        poet.writePoet();
        poet.thinkDeeply();
        System.out.println("动态代理");
        GrandPoet grandPoet = new GrandPoet("李白");
        Poet poetProxy = GrandPoetDynamicProxy.createProxy(grandPoet);
        poetProxy.readPoet();
        poetProxy.writePoet();
        poetProxy.thinkDeeply();
    }
}
